﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FileHandler.aspx.cs" Inherits="Manage_FileHandler" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>文件上传管理</title>
    <style type="text/css">
        html
        {
            height: 100%;
        }
        *
        {
            margin: 0;
            padding: 0;
        }
        body
        {
            font: 12px 微软雅黑, Verdana, Tahoma, Lucida Grande, Arial, sans-serif;
            width: 100%;
            overflow: hidden;
            border: 0;
            background-color: #ECE9D8;
            color: #000000;
            overflow-y: auto;
        }
        a
        {
            text-decoration: none;
            color: #0777c3;
        }
        a:hover
        {
            color: #FF6600;
        }
        a:disabled
        {
            color: #d9d9d9;
        }
        a:visited
        {
        }
        #main_table
        {
            border-collapse: collapse;
            empty-cells: show;
            margin: 10px;
        }
        #main_table td
        {
            vertical-align: top;
        }
        #head_dv
        {
            background: #E5EEF7;
            border-top: 1px solid #AAAAAA;
            border-bottom: 1px dashed #AAAAAA;
            font-weight: bold;
            color: #333333;
            height: 20px;
            clear: left;
            padding-left: 10px;
        }
        #upfile_dv
        {
            margin-top: 7px;
            color: #333333;
            background: #F5F5F5;
            padding: 10px;
        }
        #filelist_dv
        {
            background-color: White;
            overflow-y: auto;
        }
        #filelist_gv tr td
        {
            height: 27px;
            vertical-align: middle;
        }
        #filelist_gv tr th
        {
            height: 25px;
            vertical-align: middle;
        }
    </style>
    <%if (false)
      { %>
    <script src="../Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <% } %>
    <script src='<%=ResolveUrl("~/Scripts/jquery-1.4.1.min.js")%>' type="text/javascript"></script>
    <script type="text/javascript">
        var Folder = '<%=this.Folder %>';
        jQuery(document).ready(function () {
            setWinSeze();
            window.onresize = setWinSeze;

        });

        var setWinSeze = function () {
            var bdheight = document.documentElement.clientHeight; //获取浏览器窗体高度
            var bdwidth = document.documentElement.clientWidth; //获取浏览器窗体宽度
            jQuery('#main_table').css('height', (bdheight - 20) + "px");
            jQuery('#main_table').css('width', (bdwidth - 20) + "px");

            jQuery('#filelist_dv').css('height', (jQuery('#main_table').outerHeight() - jQuery('.top_td').outerHeight() - 20) + "px");
        }
        var insert_file = function (name) {
            var path = '/' + Folder + '/';
            var file = "<br/><a  href=\"" + path + name + "\" target='_blank'>附件:" + name + "</a>";
            window.opener.insertFile(file);
//            window.opener.document.getElementById('<%=this.FTB %>').innerHTML += file;
//            window.opener.frames['<%=this.FTB+"_designEditor" %>'].document.body.innerHTML += file;
            window.close();
        }
   
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <table id="main_table">
        <tr>
            <td class="top_td" style="height: 105px;">
                <div id="head_dv">
                    上传文件
                </div>
                <div id="upfile_dv">
                    <div>
                        <label>
                            上传文件：</label>
                        <asp:FileUpload ID="PicFileUpload" runat="server" Width="304px" />
                        <asp:Button ID="UpLoadFile" runat="server" Text="上传" Style="padding-left: 10px; padding-right: 10px;"
                            OnClick="UpLoadFile_Click" />
                    </div>
                    <div style="color: #336699; margin-top: 10px;">
                        允许上传文件类型:.zip .rar .pdf .ppt .pptx .apk .doc .docx .tar .gz .xls .xlsx
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td class="bottom_td">
                <div id="filelist_dv">
                    <asp:GridView ID="filelist_gv" runat="server" Width="99%" CellPadding="4" AutoGenerateColumns="False"
                        Style="margin-left: 10px; margin-top: 10px;" EnableModelValidation="True" ForeColor="#333333"
                        GridLines="None" OnRowDeleting="filelist_gv_RowDeleting">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:TemplateField HeaderText="文件名">
                                <ItemTemplate>
                                    <asp:Label ID="Name_lb" runat="server" Text='<%# Eval("Name")%>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="文件大小" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <%# Convert.ToInt32( Eval("Length"))/1024+"KB"%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="上传时间" ItemStyle-Width="350px" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <%# Eval("CreationTime")%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="操作" ItemStyle-Width="100px">
                                <ItemTemplate>
                                    <a href="#" onclick="insert_file('<%# Eval("Name")%>')">插入</a> &nbsp;&nbsp;
                                    <asp:LinkButton ID="del" runat="server" CommandName="Delete" OnClientClick="javascript:return confirm('您确信要删除吗!?\n删除后可能会影响文章附件下载!!!')">删除</asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    </asp:GridView>
                </div>
                <div id="page_dv" style="width: 550px; left: 50%; margin-left: -275px; position: relative;">
                    <asp:LinkButton ID="toone" runat="server" OnClick="toone_Click">[首页]</asp:LinkButton>
                    <asp:LinkButton ID="toup" runat="server" OnClick="toup_Click">[上一页]</asp:LinkButton>&nbsp;
                    <asp:LinkButton ID="tonext" runat="server" OnClick="tonext_Click">[下一页]</asp:LinkButton>
                    <asp:LinkButton ID="tolast" runat="server" OnClick="tolast_Click">[尾页]</asp:LinkButton>&nbsp;
                    [跳转到第
                    <asp:DropDownList ID="jumppage" runat="server" OnSelectedIndexChanged="jumppage_SelectedIndexChanged"
                        AutoPostBack="true" Style="height: 20px; margin-left: 3px; margin-bottom: -3px;">
                    </asp:DropDownList>
                    页]&nbsp;&nbsp; [页次:<asp:Label ID="nowpages_lb" runat="server" ForeColor="red"></asp:Label>
                    /
                    <asp:Label ID="pagecount_lb" runat="server" Text="Label"></asp:Label>页] [共<asp:Label
                        ID="pagesum" runat="server" Text="Label" ForeColor="red"></asp:Label>项
                    <asp:Label ID="tpagesizes" runat="server" Text="Label" ForeColor="red"></asp:Label>项/页]
                </div>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
